# coding=utf-8
"""
    @project: qabot
    
    @file： users.py
    @date：2023/9/4 10:09
    @desc:
"""
import uuid
import json

from django.db import models

from common.mixins.app_model_mixin import AppModelMixin

__all__ = ["Config","AuthConfig"]



class Config(AppModelMixin):
    id = models.UUIDField(primary_key=True, max_length=128, default=uuid.uuid1, editable=False, verbose_name="主键id")
    app_id = models.CharField(db_index=True, max_length=128,  verbose_name="应用ID")
    platform = models.CharField(db_index=True, max_length=128,  verbose_name="平台名称")
    config = models.CharField(max_length=1024, verbose_name="配置信息", default="")
    is_valid = models.BooleanField(default=True)
    is_active = models.BooleanField(default=False)
    create_time = models.DateTimeField(verbose_name="创建时间", auto_now_add=True, null=True)
    update_time = models.DateTimeField(verbose_name="修改时间", auto_now=True, null=True)

    REQUIRED_FIELDS = []

    class Meta:
        db_table = "xpack_config"
class AuthConfig(AppModelMixin):
    id = models.UUIDField(primary_key=True, max_length=128, default=uuid.uuid1, editable=False, verbose_name="主键id")
    user_id = models.CharField(db_index=True, max_length=128,  verbose_name="用户ID")
    platform = models.CharField(db_index=True, max_length=128,  verbose_name="平台名称")
    config = models.JSONField(max_length=1024, verbose_name="配置信息", default="")
    is_valid = models.BooleanField(default=True)
    is_active = models.BooleanField(default=False)
    create_time = models.DateTimeField(verbose_name="创建时间", auto_now_add=True, null=True)
    update_time = models.DateTimeField(verbose_name="修改时间", auto_now=True, null=True)

    REQUIRED_FIELDS = []

    class Meta:
        db_table = "auth_config"